from tutor.scripts import *
from tutor.plugins.sympy import *

N = (One / 4, One / 3, One / 2, 1, 2, 3)
FB = [ (Lambda(x, -cos(x)), pi / n) for n in [1, 2, 3] ] \
   + [ (sin, pi / n) for n in [2, 6] ]
FBD = tuple((F, t, F(t) - F(0)) for F, t in FB)

with display_block('Entradas'):
    n = One * oneof(*N)
    m = (n + 1) / n
    F, beta, delta = oneof(*FBD)
    f = Lambda(x, F(x).diff(x))
    func = f(beta * y ** m)
    xToN = x**n

with display_block('Respostas'):
    correta = 1 / (beta * m) * delta
    trocaLimites = -correta
    _ans = set([correta, trocaLimites])
    _distr = set([])
    while len(_distr) < 6:
        if oneof(False, False, True):
            _new = oneof(*_ans) * oneof(1, 2, 3, 4) / oneof(1, 2, 3, 4, 5)
        else:
            _new = -oneof(*_ans)
        if _new not in _ans:
            _ans.add(_new)
            _distr.add(_new)

    distr1, distr2, distr3, distr4, distr5, distr6 = _distr
